package com.atguigu.tingshu.album.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: atguigu
 * @create: 2024-05-07 16:18
 */
@Configuration
@ConfigurationProperties(prefix = "aliyun") //读取节点
@Data
public class GreenProperties {

    private String accessKeyID;
    private String accessKeySecret;
    private String scenes;
    private String region;


    @Bean
    public IAcsClient iAcsClient() {
        DefaultProfile profile = DefaultProfile.getProfile(
                region,
                accessKeyID,
                accessKeySecret);
        return new DefaultAcsClient(profile);
    }
}
